package jjn.round1;

import java.util.Arrays;

/**
 * @author Jjn
 * @since 2022/9/14 23:42
 */
public class LeetCode1619_MeanOfArrayAfterRemovingSomeElements {
    public double trimMean(int[] arr) {
        Arrays.sort(arr);
        int length = arr.length;
        int start = (int) (length * 0.05);
        int end = (int) (length * 19 / 20.0);
        long total = 0L;
        for (int i = start; i < end; i++) {
            total += arr[i];
        }
        return total * 1.0 / (end - start);
    }
}
